﻿<%@ Page Title="" Language="C#" MasterPageFile="~/klagesystem.Master" AutoEventWireup="true" ValidateRequest="false" CodeBehind="Klage.aspx.cs" Inherits="KlageSystem.WebForm1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script lang="javascript" type="text/javascript">
        $().ready(function () {
            $(".sagerOverview tr:odd").addClass("oddRow");
            $(".sagerOverview tr").hover(function () { $(this).addClass("hover"); }, function () { $(this).removeClass("hover"); });

            $("#ContentPlaceHolder1_txtStartforrentning").change(function () {
                var startFor = $("#ContentPlaceHolder1_txtStartforrentning").val();
                var faktor = Math.round(1 / parseFloat(startFor) * 10000) / 100;
                $("#ContentPlaceHolder1_txtFaktor").val(faktor);
            });
            $("#expandDetails").click(function () {
                $("#rawDetails").slideToggle('slow', function () {
                    var src = ($("#expandDetailsImg").attr('src') == 'images/expand.png') ? 'images/collapse.png' : 'images/expand.png';
                    $("#expandDetailsImg").attr('src', src);
                });
                $(this).blur();
            });
            if (isAppleDevice()) {
                $("#iPadUploadPlaceholder").show();
                $("#swfu_container").hide();

            }
        });

        function validate() {
            if ($("#ContentPlaceHolder1_txtBBR").val() == "") {
                alert("Du skal angive BBR");
                $("#ContentPlaceHolder1_txtBBR").focus();
                return false;
            }
            if ($("#ContentPlaceHolder1_txtArealType").val() == "") {
                alert("Du skal angive areal type");
                $("#ContentPlaceHolder1_txtArealType").focus();
                return false;
            }
            if ($("#ContentPlaceHolder1_txtAreal").val() == "") {
                alert("Du skal angive areal");
                $("#ContentPlaceHolder1_txtAreal").focus();
                return false;
            }
            if ($("#ContentPlaceHolder1_txtLeje").val() == "") {
                alert("Du skal angive leje");
                $("#ContentPlaceHolder1_txtLeje").focus();
                return false;
            }
            return true;
        }

        function jsDecimals(e) {

            var evt = (e) ? e : window.event;
            var key = (evt.keyCode) ? evt.keyCode : evt.which;
            if (key != null) {
                key = parseInt(key, 10);
                if ((key < 48 || key > 57) && (key < 96 || key > 105)) {
                    if (!jsIsUserFriendlyChar(key, "Decimals")) {
                        return false;
                    }
                }
                else {
                    if (evt.shiftKey) {
                        return false;
                    }
                }
            }
            return true;
        }

        // Function to check for user friendly keys  
        //------------------------------------------
        function jsIsUserFriendlyChar(val, step) {
            // Backspace, Tab, Enter, Insert, and Delete  
            if (val == 8 || val == 9 || val == 13 || val == 45 || val == 46) {
                return true;
            }
            // Ctrl, Alt, CapsLock, Home, End, and Arrows  
            if ((val > 16 && val < 21) || (val > 34 && val < 41)) {
                return true;
            }
            if (step == "Decimals") {
                if (val == 190 || val == 110) {  //Check dot key code should be allowed
                    return true;
                }
            }
            // The rest  
            return false;
        }

        function isAppleDevice() {
            return (
                (navigator.userAgent.toLowerCase().indexOf("ipad") > -1) ||
                (navigator.userAgent.toLowerCase().indexOf("iphone") > -1) ||
                (navigator.userAgent.toLowerCase().indexOf("ipod") > -1)
            );
        }

        var swfu;
        window.onload = function () {
            swfu = new SWFUpload({
                // Backend Settings
                upload_url: "upload.aspx",
                post_params: {
                    "ASPSESSID": "<%=Session.SessionID %>",
                    "OrgKlagenr": "<%= ((DataTier.Data_Klagebrev)ViewState["klageBrev"]).OrgKlagenr %>",
                    "KlageNr": "<%= ((DataTier.Data_Klagebrev)ViewState["klageBrev"]).KlageNr %>"
                },

                // File Upload Settings
                file_size_limit: "2 MB",
                file_types: "*.jpg",
                file_types_description: "JPG Images",
                file_upload_limit: "0",    // Zero means unlimited

                // Event Handler Settings - these functions as defined in Handlers.js
                //  The handlers are not part of SWFUpload but are part of my website and control how
                //  my website reacts to the SWFUpload events.
                file_queue_error_handler: fileQueueError,
                file_dialog_complete_handler: fileDialogComplete,
                upload_progress_handler: uploadProgress,
                upload_error_handler: uploadError,
                upload_success_handler: uploadSuccess,
                upload_complete_handler: uploadComplete,

                // Button settings
                button_image_url: "images/XPButtonNoText_160x22.png",
                button_placeholder_id: "spanButtonPlaceholder",
                button_width: 160,
                button_height: 22,
                button_text: '<span class="button">Vælg billeder <span class="buttonSmall">(2 MB Max)</span></span>',
                button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }',
                button_text_top_padding: 1,
                button_text_left_padding: 5,

                // Flash Settings
                flash_url: "flash/swfupload.swf",	// Relative to this file

                custom_settings: {
                    upload_target: "divFileProgressContainer"
                },

                // Debug Settings
                debug: false
            });
        }
    </script>
    <script lang="javascript" type="text/javascript" src="scripts/swfupload.js"></script>
    <script lang="javascript" type="text/javascript" src="scripts/handlers.js"></script>
    <script lang="javascript" type="text/javascript" src="scripts/ckeditor.js"></script>
    <link rel="stylesheet" type="text/css" href="scripts/contents.css" />

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:LinkButton ID="btnTilbage" runat="server" OnClick="btnBack_Click">&lt;--Tilbage</asp:LinkButton>
    <h1>
        <a href="#" id="expandDetails">
            <img src="images/expand.png" id="expandDetailsImg" title="Fold ud for at se stamoplysninger og vurderingsmeddelelse" /></a>&nbsp;
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></h1>
    <div id="rawDetails">
        <table style="width: 900px;">
            <tr>
                <th>Ejer firma:</th>
                <td>
                    <asp:Label ID="txtRawEjerFirma" runat="server" Text=""></asp:Label></td>
                <th>Co/ejer:</th>
                <td>
                    <asp:Label ID="txtRawCoEjer" runat="server" Text=""></asp:Label>
                </td>
            </tr>
            <tr>
                <th>Ejd Postnr:</th>
                <td>
                    <asp:Label ID="txtRawEjdPostNr" runat="server" Text=""></asp:Label></td>
                <th>Ejd By:</th>
                <td>
                    <asp:Label ID="txtRawEjdBy" runat="server" Text=""></asp:Label>
                </td>
            </tr>
            <tr>
                <th>Titel:</th>
                <td>
                    <asp:Label ID="txtRawTitel" runat="server" Text=""></asp:Label></td>
                <th>Ejer Kontakt:</th>
                <td>
                    <asp:Label ID="txtRawEjerKontakt" runat="server" Text=""></asp:Label>
                </td>
            </tr>
            <tr>
                <th>Kunde tlf:</th>
                <td>
                    <asp:Label ID="txtRawKundeTelefon" runat="server" Text=""></asp:Label></td>
                <th>Ejer e-mail:</th>
                <td>
                    <asp:HyperLink ID="linkRawEjerEmail" runat="server"></asp:HyperLink>
                </td>
            </tr>
            <tr>
                <th>Potentiale</th>
                <td>
                    <asp:Label ID="txtRawPotentiale" runat="server" Text=""></asp:Label></td>
                <th>Sagstype:</th>
                <td>
                    <asp:Label ID="txtRawSagsType" runat="server" Text=""></asp:Label></td>
            </tr>
            <tr>
                <th>Bemærkninger:</th>
                <td>&nbsp;</td>
                <th>Vurderingsmeddelelse:</th>
                <td>
                    <asp:HyperLink ID="hypVurderingsmeddelese" runat="server" Visible="false" Target="_blank">Se vurderingsmeddelese</asp:HyperLink></td>
            </tr>
            <tr>
                <td colspan="4">
                    <asp:Label ID="txtRawBemærkning" runat="server" Text=""></asp:Label></td>
            </tr>
        </table>
    </div>
    <!--
    Ejer_Firma|Co/ejer|Ejd_Post nr|Ejd_By|Titel|Ejer_Kontakt|Kunde_Telefon|Ejer_Email|Potentiale|Sagstype|Bemærkning|
    -->
    <table id="contentTable" style="width: 900px;">
        <tr>
            <td>Skattecenter:</td>
            <td>
                <asp:DropDownList ID="lstSkattecenter" runat="server" ViewStateMode="Enabled"></asp:DropDownList></td>
            <td>Matrikel nummer:</td>
            <td>
                <asp:TextBox ID="txtMatrNr" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td colspan="4">Summarisk beskrivelse:</td>
        </tr>
        <tr>
            <td colspan="4">
                <asp:TextBox ID="txtSumBeskrivelse" runat="server" cols="80" Rows="10" CssClass="ckeditor" TextMode="MultiLine" Width="964px" ValidateRequestMode="Disabled">&lt;ul&gt;
&lt;li&gt;Hvordan ser bygningen ud?&lt;/li&gt;
&lt;li&gt;Opført år?&lt;/li&gt;
&lt;li&gt;Loftshøjde - porte&lt;/li&gt;
&lt;li&gt;Tilstand?&lt;/li&gt;
&lt;li&gt;Bygningssætninger&lt;/li&gt;
&lt;li&gt;Vedligeholdelse&lt;/li&gt;
&lt;li&gt;Energimæssige forhold, opvarmning, lys, mv.&lt;/li&gt;
&lt;li&gt;Er installationerne adskilt, mht. procesenergi og IKKE procesenergi?&lt;/li&gt;
&lt;li&gt;Vanskeligt at etablere vedvarende energianlæg&lt;/li&gt;
&lt;li&gt;Bygningens egenthed til sin anvendelse&lt;/li&gt;
&lt;li&gt;Beliggende tæt på boligområde or problemer med støj&lt;/li&gt;
&lt;li&gt;Adgangsforhold, tilkørselsmuligheder og afstand til primært vejnet&lt;/li&gt;
&lt;li&gt;Mulighed for bedbånd&lt;/li&gt;
&lt;li&gt;Tilslutningsmulighed for kommunal forsyning&lt;/li&gt;
                    &lt;/ul&gt;
                </asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>Billeder:</td>
            <td>
                <asp:Panel ID="pnlBilleder" runat="server"></asp:Panel>
            </td>
        </tr>
        <tr>
            <td colspan="4">
                <div id="swfu_container" style="margin: 0px 10px;">
                    <div>
                        <span id="spanButtonPlaceholder"></span>

                    </div>
                    <div id="divFileProgressContainer" style="height: 75px;"></div>
                </div>
                <div id="iPadUploadPlaceholder" style="display: none;">
                    <asp:FileUpload ID="fileUploader" runat="server" />
                    &nbsp;<asp:Label ID="lblUploader" runat="server" Text="" ForeColor="Red"></asp:Label>
                    <br />
                    <asp:Button ID="btnUpload" runat="server" Text="Upload billede" OnClick="btnUpload_Click" />
                </div>
            </td>
        </tr>
        <tr>
            <td>Lokalplannr:</td>
            <td>
                <asp:TextBox ID="txtLokalplannr" runat="server"></asp:TextBox></td>
            <td>Lokalplanformål:</td>
            <td>
                <asp:TextBox ID="txtLokalplanformaal" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>Udnyttelsesprocent:</td>
            <td colspan="3">
                <asp:TextBox ID="txtUdnyttelsespct" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td>
                <asp:CheckBox ID="chkForurening" Text="Forurening" runat="server" /></td>
            <td>Forureningsniveau:&nbsp;
                <asp:DropDownList ID="dropV2" runat="server"></asp:DropDownList>
            </td>
            <td>Kortlægningsnr:</td>
            <td>
                <asp:TextBox ID="txtKortlaegningsnr" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td>Startforrentning:</td>
            <td>
                <asp:TextBox ID="txtStartforrentning" runat="server" MaxLength="6" onkeydown="return jsDecimals(event);"></asp:TextBox></td>
            <td>Faktor:</td>
            <td>
                <asp:TextBox ID="txtFaktor" runat="server" MaxLength="6" onkeydown="return jsDecimals(event);"></asp:TextBox></td>
        </tr>
        <tr>
            <td colspan="4">
                <asp:Panel ID="pnlArealer" runat="server"></asp:Panel>
                <asp:Table ID="tblArealer" CssClass="sagerOverview" Width="100%" runat="server">
                    <asp:TableHeaderRow TableSection="TableHeader">
                        <asp:TableHeaderCell Text="BBR"></asp:TableHeaderCell>
                        <asp:TableHeaderCell Text="Type"></asp:TableHeaderCell>
                        <asp:TableHeaderCell Text="Areal"></asp:TableHeaderCell>
                        <asp:TableHeaderCell Text="Leje pr. kvm"></asp:TableHeaderCell>
                        <asp:TableHeaderCell Text=""></asp:TableHeaderCell>
                    </asp:TableHeaderRow>
                    <asp:TableFooterRow TableSection="TableFooter">
                        <asp:TableCell>
                            <asp:TextBox ID="txtBBR" runat="server"></asp:TextBox>
                        </asp:TableCell>
                        <asp:TableCell>
                            <asp:TextBox ID="txtArealType" runat="server"></asp:TextBox>
                        </asp:TableCell>
                        <asp:TableCell>
                            <asp:TextBox ID="txtAreal" MaxLength="6" onkeydown="return jsDecimals(event);" runat="server"></asp:TextBox>
                        </asp:TableCell>
                        <asp:TableCell>
                            <asp:TextBox ID="txtLeje" MaxLength="6" onkeydown="return jsDecimals(event);" runat="server"></asp:TextBox>
                        </asp:TableCell>
                        <asp:TableCell>
                            <asp:LinkButton ID="btnInsert" OnClick="btnInsert_Click1" CssClass="deleteButton" OnClientClick="return validate();" ToolTip="Klik her for at tilføje en linje" runat="server">Indsæt</asp:LinkButton>
                        </asp:TableCell>
                    </asp:TableFooterRow>
                </asp:Table>
            </td>
        </tr>
        <tr>
            <td>Skat/afg:</td>
            <td>
                <asp:TextBox ID="txtSkatAfgift" MaxLength="8" onkeydown="return jsDecimals(event);" runat="server"></asp:TextBox></td>
            <td>Forsikring pr. m2:</td>
            <td>
                <asp:TextBox ID="txtForsikringM2" MaxLength="6" onkeydown="return jsDecimals(event);" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>Vedligehold pr. m2:</td>
            <td>
                <asp:TextBox ID="txtVedligeholdM2" MaxLength="6" onkeydown="return jsDecimals(event);" runat="server"></asp:TextBox></td>
            <td>Administrations %</td>
            <td>
                <asp:TextBox ID="txtAdmUdgPct" MaxLength="2" onkeydown="return jsDecimals(event);" runat="server"></asp:TextBox></td>

        </tr>
        <tr>
            <td>Renhold udg. pr m2:</td>
            <td>
                <asp:TextBox ID="txtRenholdM2" MaxLength="6" onkeydown="return jsDecimals(event);" runat="server"></asp:TextBox></td>
            <td colspan="2">&nbsp;</td>
        </tr>
        <tr>
            <td colspan="4" style="text-align: left">
                <asp:Button ID="btnDemote" runat="server" Text="Demote" OnClick="btnDemote_Click" />&nbsp;
                <asp:Button ID="btnDelete" runat="server" Text="Slet sag" OnClick="btnDelete_Click" OnClientClick="return confirm('Er du sikker?');" />
                <asp:Button ID="btnBack" runat="server" Text="Tilbage" OnClick="btnBack_Click" />
                &nbsp;<asp:Button ID="btnSave" runat="server" Text="Gem" OnClick="btnSave_Click" />
                &nbsp;<asp:Button ID="btnSendMail" runat="server" Text="Afsend E-mail" OnClick="btnSendMail_Click" />

            </td>
        </tr>
    </table>

</asp:Content>
